Repository navigation
ci: fix the random "has no dist/convertapi.d.ts" (tar | grep -q under pipefail) - #31
Merged
Merged
Conversation
`tar -tzf "$TGZ" | grep -qx "package/$f"` under pipefail failed at random:
GNU tar writes the listing one line per write(), grep -q exits at its
match, tar's next write fails ("tar: stdout: write error", exit 2), and
pipefail turns that into "has no dist/convertapi.d.ts". The main Build of
df2759a failed this way on 2026-11-09 (run 42633356489, attempt 1).
Pack (build.yml) and "Check the package" (publish.yml) now list the
tarball into $RUNNER_TEMP once and grep the file. The error messages are
unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 9, 2026
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the build and release package-validation changes.
No open issues 🎉
What changed in this PR
Fixes intermittent package-validation failures in the build and release workflows caused by grep -q closing a pipe while tar is still writing under pipefail.
Changes:
- Saves the tarball listing to a temporary file before checking required package files.
- Preserves missing-file error messages while allowing tar read failures to surface directly.
| File | Description |
|---|---|
.github/workflows/publish.yml |
Uses a saved tarball listing for release package validation. |
.github/workflows/build.yml |
Uses a saved tarball listing for build package validation. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The
mainBuild of df2759a failed on 2026-11-09 in Pack (run 42633356489, attempt 1):npm's own file list for that tarball contains
dist/convertapi.d.ts, and attempt 2 passed. #30 failed the same way once before a rerun passed.The check was
tar -tzf "$TGZ" | grep -qx "package/$f"underset -euo pipefail:write()(strace: 33 writes for this 31-file tarball, wheredist/convertapi.d.tsis entry 25).grep -qexits as soon as it matches.stdout: write errorand exits 2.pipefailfails the pipeline, and the||prints a false "has no …".The "Check the package" step in
publish.ymlhas the same line, so a release could stop the same way.Change
Both steps list the tarball once into
$RUNNER_TEMP/tgz-files.txtand grep that file. The error messages are unchanged. A tarball that tar cannot read now stops the step with tar's own error instead of "has no …".Dropping
-qand sending grep's output to/dev/nullwould also work with GNU grep, which drains its input in that case, but the file doesn't depend on that.Tested
In an Ubuntu 24.04 container (GNU tar 1.35, GNU grep 3.11, bash 5.2) with SIGPIPE ignored, as on the runner. Each step's
run:script was read from the workflow file and run withbash -euo pipefailagainst the package built frommain(npm ci,npm run build,npm pack), withnpmstubbed to hand over that tarball:maintar: stdout: write error, then "has no …")dist/convertapi.d.ts::error::out/convertapi-js-0.0.0-ci.12.gdf2759a.tgz has no dist/convertapi.d.tsdist/convertapi.js::error::… has no dist/convertapi.jsdist/convertapi.d.ts::error::out/convertapi-js-9.9.9-local.1.tgz has no dist/convertapi.d.tsThis PR's own Build runs the new Pack step.
publish.ymlruns only on a release, so it was tested only as above.Same fix for the release check in ConvertAPI/convertapi-library-node#128. The same defensive change, where nothing fails today: ConvertAPI/convertapi-library-python#65 and ConvertAPI/convertapi-library-java#61.
🤖 Generated with Claude Code